/*
 * @Author: 无聊 7989314+Hwz1997@user.noreply.gitee.com
 * @Date: 2025-07-01 12:03:32
 * @LastEditors: 无聊 7989314+Hwz1997@user.noreply.gitee.com
 * @LastEditTime: 2025-07-01 12:03:36
 * @FilePath: \keep_motion_api\models\product\activityParticipation.model.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
const mongoose = require('mongoose');
const Schema = mongoose.Schema;

// 产品活动参与模型
const activityParticipationSchema = new Schema({
  user_id: { 
    type: Schema.Types.ObjectId, 
    ref: 'User',
    required: true 
  },
  activity_id: { 
    type: Schema.Types.ObjectId, 
    ref: 'ProductActivity',
    required: true 
  },
  participation_date: { type: Date, default: Date.now },
  redeemed: { type: Boolean, default: false },
  redemption_date: Date,
  order_id: { 
    type: Schema.Types.ObjectId, 
    ref: 'Order' 
  }
});

module.exports = mongoose.model('ActivityParticipation', activityParticipationSchema);
